<template>
	<view class="layout">
		<view class="navbar">
			<view class="statusBar" :style="{height:getStatusBarHeight() + 'px'}"></view>
			<view class="titleBar" :style="{height:getTitleBarHeight() + 'px'}">
				<view class="title">{{title}}</view>
				<view class="search">
					<uni-search-bar radius="40" placeholder="搜索" clearButton="auto" cancelButton="none"
						@confirm="search" />
				</view>
			</view>
		</view>
		<!-- 填充区域 -->
		<view class="fill" :style="{height:getNavBarHeight() + 'px'}"></view>
	</view>
</template>

<script setup>
	import {
		getNavBarHeight,
		getStatusBarHeight,
		getTitleBarHeight
	} from "@/utils/system.js"

	defineProps({
		title: {
			type: String,
			default: "壁纸"
		}
	})
	const search = () => {
		console.log("search");
	}
</script>

<style lang="scss" scoped>
	.layout {
		.navbar {
			position: fixed; // 固定在顶部
			top: 0;
			left: 0;
			width: 100%;
			z-index: 10;
			padding: 10rpx 0;
			background:
				linear-gradient(to bottom, rgba(173, 216, 230, 0.9), rgba(230, 230, 250, 0.9)),
				linear-gradient(to right, rgba(255, 182, 193, 0.9), rgba(216, 191, 216, 0.9));

			.titleBar {
				display: flex;
				align-items: center;

				.title {
					font-size: 60rpx;
					padding-left: 20rpx;
					font-weight: 700;
					color: #59dce8;
				}

				.search {
					padding-left: 20rpx;
					width: 400rpx;

					.uni-search-bar {
						background-color: #f0f0f0;
						box-shadow: 0 2rpx 5rpx rgba(0, 0, 0, 0.1);
					}
				}
			}
		}


	}
</style>